package com.huawei.appmarket.framework.widget.uxwidget.hwdotspageindicator;

import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import o.MinimumFactory;

class HwTopBannerIndicator$4 implements Runnable {
    final /* synthetic */ HwTopBannerIndicator ˋ;

    HwTopBannerIndicator$4(HwTopBannerIndicator hwTopBannerIndicator) {
        this.ˋ = hwTopBannerIndicator;
    }

    public void run() {
        if (HwTopBannerIndicator.ˎ(this.ˋ) != null && HwTopBannerIndicator.ˎ(this.ˋ).ˎ() != null) {
            if (HwTopBannerIndicator.onPageScrollStateChanged(this.ˋ)) {
                Object tag = this.ˋ.getTag();
                if (!(tag instanceof CardBean) || ((CardBean) tag).ॱᐧ()) {
                    if (HwTopBannerIndicator.ॱ(this.ˋ)) {
                        if (3 > HwTopBannerIndicator.ˋ(this.ˋ)) {
                            return;
                        }
                    } else if (2 > HwTopBannerIndicator.ˋ(this.ˋ)) {
                        return;
                    }
                    int ˊ = ˊ(HwTopBannerIndicator.ˎ(this.ˋ).ˋ());
                    if (HwTopBannerIndicator.onPageScrollStateChanged(this.ˋ)) {
                        HwTopBannerIndicator.ˎ(this.ˋ).setCurrentItem(ˊ, true);
                    }
                    if (HwTopBannerIndicator.onPageScrolled(this.ˋ)) {
                        HwTopBannerIndicator.ˎ(this.ˋ, ˊ);
                        return;
                    } else {
                        this.ˋ.ॱ();
                        return;
                    }
                }
                HwTopBannerIndicator.ˏ(this.ˋ, false);
                HwTopBannerIndicator.onPageScrollStateChanged(this.ˋ, false);
                return;
            }
            HwTopBannerIndicator.ˏ(this.ˋ, false);
        }
    }

    private int ˊ(int i) {
        int i2;
        if (MinimumFactory.getBoolValue(this.ˋ.getContext())) {
            i2 = i - 1;
            if (i2 < 0) {
                return this.ˋ.ˏ();
            }
            return i2;
        }
        i2 = i + 1;
        if (i2 >= 1000) {
            return this.ˋ.ˏ();
        }
        return i2;
    }
}
